#ifndef SOCKETMANAGER_H
#define SOCKETMANAGER_H

#include <QTcpSocket>
//单例模式下的套接字构造与连接
class SocketManager : public QObject {
    Q_OBJECT
public:
    static SocketManager& getinstance() {
        static SocketManager instance;
        return instance;
    }
    void initializeConnection() {
        if (m_socket->state() == QAbstractSocket::UnconnectedState) {
            m_socket->connectToHost("192.168.6.237", 6666);
        }
    }
    SocketManager(const SocketManager&) = delete ;
    SocketManager& operator=(const SocketManager&) = delete ;
    QTcpSocket * socket(){
        return m_socket;
    }
private:
    explicit SocketManager(QObject *parent = nullptr):QObject(parent){
        //m_socket->connectToHost("192.168.6.237",8888);
        m_socket =new QTcpSocket;
    }
    ~SocketManager(){}
    QTcpSocket * m_socket;
};
#pragma pack(push, 1)
struct sendRig{
    int type;
    char Account[64];
    char password[24];
    bool Idtype;
    char tele[24];
    int IC;
    char teletwo[24];
    char state[24];
    char ID[24];
    int num[10];
};
#pragma pack(pop)
#endif // SOCKETMANAGER_H
